package edu.lingnan.comfig;

import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author xBaozi
 * @version 1.0
 * @classname MyBatisPlusConfig
 * @description MP的配置类
 * @date 2022/5/26 20:43
 */
@Configuration
public class MyBatisPlusConfig {

    /**
     * @description 定义一个分页内部拦截器并交由Spring管理
     * @author xBaozi
     * @date 20:48 2022/4/28
     **/
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
        mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor());
        return mybatisPlusInterceptor;
    }
}
